<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>测试ng-if</title>
</head>
<body ng-app="app">
  <div ng-controller="ctrl">
    <input id="flag" type="checkbox" ng-model="flag"/>
    <label for="flag">来去自如</label>
    <div ng-if="flag">我又回来了</div>
    <div ng-if="!flag">我又回去了</div>
  </div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.7/angular.js"></script>
  <script>
    let app = angular.module("app", []);
    app.controller("ctrl", ($scope) => {
      $scope.flag = false;
    });
  </script>
</body>
</html>
